
package com.groupalpha.studentport;

import java.util.List;

import RSS.RSSItem;
import android.content.Context;
import android.graphics.Color;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class LunchAdapter extends BaseAdapter implements OnClickListener {
    private Context context;

    private List<RSSItem> listPhonebook;

    public LunchAdapter(Context context, List<RSSItem> listPhonebook) {
        this.context = context;
        this.listPhonebook = listPhonebook;
    }

    public int getCount() {
        return listPhonebook.size();
    }

    public Object getItem(int position) {
        return listPhonebook.get(position);
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup viewGroup) {
        RSSItem entry = listPhonebook.get(position);
        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.rowlayoutlist, null);
        }
        TextView title = (TextView) convertView.findViewById(R.id.titleofmenu);
        title.setText(entry.getTitle());
        WebView view = (WebView) convertView.findViewById(R.id.webView1);
	//view.loadData(entry.getDescription(), "text/html", "utf-16" +
			view.loadDataWithBaseURL (null, entry.getDescription().replaceAll("Dagens lunch", "Linsen"), "text/html", "utf-8","about:blank");
//        TextView kotttexten = (TextView) convertView.findViewById(R.id.description);
//        kotttexten.setText(Html.fromHtml(entry.getDescription()));

        
        
        
        // Set the onClick Listener on this button
        
        // Set the entry, so that you can capture which item was clicked and
        // then remove it
        // As an alternative, you can use the id/position of the item to capture
        // the item
        // that was clicked.
        
        // btnRemove.setId(position);
       

        return convertView;
    }

    @Override
    public void onClick(View view) {


    }


}
